package com.example.customview.adapter

import android.content.Context
import android.util.Log
import android.view.View
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.RelativeLayout
import android.widget.TextView
import com.example.customview.R
import com.example.customview.base.BaseRecyclerAdapter
import com.example.customview.base.RecyclerViewHolder
import com.example.customview.bean.TableBean

/**
 * Created by Android Studio.
 * User: wsl
 * Date: 2020/12/11
 * Time: 3:07 PM
 * Description:
 */
class ItemPersonalAdapter(context: Context, lister: ListenerItemBack) : BaseRecyclerAdapter<TableBean>(context) {

    var  mLister : ListenerItemBack = lister

    override fun getLayoutId(viewType: Int): Int {
        return R.layout.item_personal_view
    }


    override fun bindView(holder: RecyclerViewHolder?, position: Int) {
        val relatve= holder?.getView<LinearLayout?>(R.id.relatve)
        relatve?.setOnClickListener {
            mLister.ItembackPosition(position)
            refreshData(position)
        }
        val img= holder?.getView<ImageView?>(R.id.img)

        val name= holder?.getView<TextView?>(R.id.name)
//        name?.setText(data.get(position).listData.title)

    }

    fun refreshData(position: Int){
        notifyDataSetChanged()
    }


    interface ListenerItemBack {
        fun ItembackPosition(position: Int)
    }


}

